<?php

class Db_Tables2_BLogsContractPayPlan
{
	function __construct() {
		$this->dealers_db = Zend_Registry::get("dealers_db");
	}
	
	function GetPayPlans($contract_id)
	{
		$select = $this->dealers_db->select();
		$select->from("b_logs_contract_pay_plan", "*");
		$select->where("contract_id = ?", $contract_id);
		$select->order("plan_date ASC");
		$result = $this->dealers_db->fetchAll($select);
		
		return $result;
	}
	
	function CancelLog($contract_id)
	{
		$where = "contract_id=".$contract_id." and status=0";
		
		$this->dealers_db->delete("b_logs_contract_pay_plan", $where);
		
		return TRUE;
	}
}